const fs = require('fs');

fs.stat('./data.txt', (err, data) => {
    if (err) {
        console.error('data, err:', err);
        return;
    }

    console.log('data, stats: ', data);
    console.log('data, isFile:', data.isFile());
})

fs.stat('./not-exist.txt', (err, data) => {
    if (err) {
        console.error('not-exist, err:', err);
        console.log(err.constructor, err.message);
        return;
    }

    console.log('not-exist, stats: ', data);
    console.log('not-exist, isFile:', data.isFile());
})
